package com.major.tree.threadbinary;

public class ThreadBinaryMain {
    public static void main(String[] args) {
        ThreadNode root = new ThreadNode(1, "111");
        ThreadNode node2 = new ThreadNode(2, "222");
        ThreadNode node3 = new ThreadNode(3, "333");
        ThreadNode node4 = new ThreadNode(4, "444");
        ThreadNode node5 = new ThreadNode(5, "555");
        ThreadNode node6 = new ThreadNode(6, "666");
        ThreadNode node7 = new ThreadNode(7, "777");

        root.setLeftNode(node2);
        root.setRightNode(node3);
        node2.setLeftNode(node4);
        node2.setRightNode(node5);
        node3.setLeftNode(node6);
        node3.setRightNode(node7);

        ThreadBinaryTree threadBinaryTree = new ThreadBinaryTree();
        threadBinaryTree.setRoot(root);

        // 线索化
        threadBinaryTree.threadNodes();

        ThreadNode rightNode = node5.getRightNode();
        ThreadNode leftNode = node5.getLeftNode();
        //System.out.println(leftNode);
        //System.out.println(rightNode);

        threadBinaryTree.threadIterate();

//        ThreadNode node = threadBinaryTree.getNodeByNo(5);
//        System.out.println(node.getLeftNode());
//        System.out.println(node.getRightNode());


    }
}
